/* $RCSFile: DoubleDataType.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/UI/DataTypes/DoubleDataType.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:29  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Globalization;
using System.Diagnostics;
using System.IO;
using System.ComponentModel;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

using AddonNice.UI;
using AddonNice.UI.WebControls;
using AddonNice.Configuration;
using AddonNice.Diagnostics;

namespace AddonNice.UI.DataTypes
{
	/// <summary>
	/// DoubleDataType
	/// </summary>
	public class DoubleDataType : NumericDataType
	{
		public DoubleDataType()
		{
			InnerDataType = PropertiesDataType.Double;
		}

		public override string Val
		{
			get
			{
				return innerValue;
			}
			set
			{
				//Check type
				try
				{
    				double i = double.Parse(value,CultureInfo.InvariantCulture);
				}
				catch (Exception ex)
				{
					if ( DataTypeTraceSwitch.Sw.TraceError )
                        Trace.WriteLine( string.Format(CultureInfo.InvariantCulture,"DoubleDataType Set Value: {0}, ex: {1}",value,ex),DataTypeTraceSwitch.Sw.Info);
                    throw;
				}
				innerValue = value;
			}
		}

		public override string Description
		{
			get
			{
				return "Double";
			}
		}
	}

}